﻿{extend name="public:layout" /}

{block name="title"}
	<title>{:site('siteName')}-首页</title>
{/block}

{block name="content"}
	<div class="img_gallery">
		<div class="point">
			{volist name="banners" id="v"}
				<a href="javascript:;">{$i}</a>
			{/volist}
		</div>
		<div class="main_img">
			<ul>
				{volist name="banners" id="v"}
					<li><a href="{$v.link}" ><img src="{$v.src}" ></a></li>
				{/volist}
			</ul>
			<a href="javascript:;" id="btn_prev"></a>
			<a href="javascript:;" id="btn_next"></a>
		</div>
	</div>
	
	<div class="user_center3" style="height:180px;">
		<ul>
			<li><a href="{:url('index/user/index')}"><img src="__STATIC__/{$theme}/img/con_4.png"/><br /><p>会员中心</p></a></li>
			<li><a href="{:url('index/account/son')}"><img src="__STATIC__/{$theme}/img/con_5.png"/><br /><p>共享账号</p></a></li>
			<li style="border-right:none;"><a href="{:url('index/account/index')}"><img src="__STATIC__/{$theme}/img/con_2.png"/><br /><p>友豆账号</p></a></li>
			<li><a href="/article/list/4"><img src="__STATIC__/{$theme}/img/con_7.png"/><br /><p>常见问题</p></a></li>
			<li><a href="/article/list/5"><img src="__STATIC__/{$theme}/img/con_8.png"/><br /><p>帮助中心</p></a></li>
			<li style="border-right:none;"><a href="/article/6/index/9"><img src="__STATIC__/{$theme}/img/con_9.png"/><br /><p>联系我们</p></a></li>
		</ul>
	</div>

	<div class="index_gonggao">
		<p>最新公告</p>
		<ul>
			{if isset($articles[1])}
				{volist name="articles[1]" id="v"}
					<li><a href="{:url('index/article/details',['id'=>$v['id']])}" title="{$v.title}">{$v.title}<span>{:date('Y-m-d',$v['update_time'])}</span></a></li>
				{/volist}
			{/if}
		</ul>
	</div>

	<div class="index_gonggao">
		<p>帮助中心</p>
		<ul>
			{if isset($articles[5])}
				{volist name="articles[1]" id="v"}
					<li><a href="{:url('index/article/details',['id'=>$v['id']])}" title="{$v.title}">{$v.title}<span>{:date('Y-m-d',$v['update_time'])}</span></a></li>
				{/volist}
			{/if}
		</ul>
	</div>

	<div class="index_gonggao">
		<p>常见问题</p>
		<ul>
			{if isset($articles[4])}
				{volist name="articles[1]" id="v"}
					<li><a href="{:url('index/article/details',['id'=>$v['id']])}" title="{$v.title}">{$v.title}<span>{:date('Y-m-d',$v['update_time'])}</span></a></li>
				{/volist}
			{/if}
		</ul>
	</div>

{/block}

{block name="script"}
	<script type="text/javascript" src="__STATIC__/{$theme}/js/jquery.event.drag.js"></script>
	<script type="text/javascript" src="__STATIC__/{$theme}/js/jquery.touchSlider.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$(".img_gallery").hover(function(){
				$("#btn_prev,#btn_next").fadeIn()
			},function(){
				$("#btn_prev,#btn_next").fadeOut()
			});
			
			$dragBln = false;
			
			$(".main_img").touchSlider({
				flexible : true,
				speed : 200,
				btn_prev : $("#btn_prev"),
				btn_next : $("#btn_next"),
				paging : $(".point a"),
				counter : function (e){
					$(".point a").removeClass("on").eq(e.current-1).addClass("on");//图片顺序点切换
					$(".img_font span").hide().eq(e.current-1).show();//图片文字切换
				}
			});
			
			$(".main_img").bind("mousedown", function() {
				$dragBln = false;
			});
			
			$(".main_img").bind("dragstart", function() {
				$dragBln = true;
			});
			
			$(".main_img a").click(function(){
				if($dragBln) {
					return false;
				}
			});
			
			timer = setInterval(function(){
				$("#btn_next").click();
			}, 5000);
			
			$(".img_gallery").hover(function(){
				clearInterval(timer);
			},function(){
				timer = setInterval(function(){
					$("#btn_next").click();
				},5000);
			});
			
			$(".main_img").bind("touchstart",function(){
				clearInterval(timer);
			}).bind("touchend", function(){
				timer = setInterval(function(){
					$("#btn_next").click();
				}, 5000);
			});
			
		});
	</script>
{/block}
